#ifndef __OGREENGINE_H__
#define __OGREENGINE_H__

#pragma once

class CSceneBase;

struct STask
{
	STask(int id) : m_Id(id) { };
	STask(int id, int sceneId) : m_Id(id), m_SceneId(sceneId) { };
	int m_Id;
	union
	{
		int m_SceneId;
	};
};

class COgreEngine : public FrameListener
{
public:
	typedef std::vector<CSceneBase *> TScenes;
	typedef std::vector<STask> TTasks;
//Methods
public:
	COgreEngine(void);
	virtual ~COgreEngine(void);

	void Create(void);
	void AddDefaultLight(void);

	void startNextScene(void);
	void startPreviousScene(void);
	void addScene(CSceneBase *pScene);
	void startScene(int sceneId);

	virtual bool frameStarted(const FrameEvent& evt);
	virtual bool frameEnded(const FrameEvent& evt);

	void setDebugText(String const &text);

	TScenes::iterator findScene(int const id);
	CEGUI::MouseButton convertOgreButtonToCegui(int buttonID);

//Variables
public:
	Root m_Root; 
	RenderWindow * m_pCurrentRenderWindow;
	SceneManager * m_pCurrentSceneManager;
	EventProcessor * m_pEventProcessor;
	CSceneBase * m_pCurrentScene;
	Viewport * m_pViewPort;
	Camera * m_pDefaultCamera;

	String m_ResourceFilename;
	String m_ApplicationName;

	bool m_HasDebugLight;

	TScenes m_Scenes;

	bool m_RemoveListeners;
	bool m_AddListeners;
	CSceneBase * m_pLastScene;

	TTasks m_Tasks;

	OMTimer m_Timer;
	Real m_LastTime;
	Real m_MsToWait;

	CEGUI::OgreCEGUIRenderer* m_GUIRenderer;
	CEGUI::System* m_GUISystem;

	bool m_statsOn;
};

#endif //__OGREENGINE_H__